package apralms

class ProjectIndex {
	String code
	String name
	
	float targetValue = 0f
	float limitValue = 0f
	float spareValue = 0f
	
	float readyTarget = 0f
	float readyLimit = 0f
	
	float assignValue = 0f
	float calValue = 0f
	
	boolean known = false

	static constraints = {
		code blank:false, maxSize:10
		name blank:false, maxSize:50
		
		project blank:false
		parameter blank:false
		
		targetValue min:0f, max:100000f
		limitValue min:0f, max:100000f
		spareValue min:0f, max:1f
		
		readyTarget min:0f, max:100000f
		readyLimit min:0f, max:100000f
		
		assignValue min:0f, max:100000f
		calValue nullable:true
	}

	static belongsTo = [project:Project, scheme:Scheme, parameter:Parameter]
	
	def beforeInsert = {

	}
	
	String toString(){
		"${project.name} - ${parameter.name} [${parameter.type}] T=${targetValue} L=${limitValue}"
	}
}
